<template>
    <div v-if="showTransverse">
        <div v-for="(item,index) of list" :key="index">
            <div class="title">
                <img :src="item.image.properties.image">
            </div>
            <img class="banner-image" :src="item.ad.properties.image">
            <div class="wrapper">
                <swiper :options="swiperOption">
                    <swiper-slide v-for="(view,index) of item.recommend" :key="index" class="product-view">
                        <div>
                            <img :src="view.properties.image">
                            <div class="tit">{{view.properties.title}}</div>
                            <div class="price" v-if="view.properties.price">￥ {{view.properties.price}}</div>
                        </div>
                    </swiper-slide>
                </swiper>
            </div>
        </div>
    </div>
</template>

<script>
export default {
  name: 'homeTransverse',
  data() {
    return {
      swiperOption: {
        loop: false,
        autoplay: false,
        slidesPerView: 'auto'
      }
    }
  },
  props: {
    list: {
      type: Array,
      default: () => {}
    }
  },
  computed: {
    showTransverse() {
      return this.list.length
    }
  }
}
</script>

<style lang="less" scoped>
@import "~styles/mixin.less";
.title{
    .h(92);
    .lh(92);
    text-align: center;
    img{
        .w(186);
        .h(36);
    }
}
.banner-image{
    width:100%
}
.wrapper{
    background: #fff;
    .product-view{
        .w(220);
        .h(318);
        .padding(20,20);
        float:left;
        img{
            .w(180);
            .h(180);
        }
        .tit{
            color:#333;
            .margin(8,0);
            .ellipsis();
            .lh(40);
        }
        .price{
            color:#FF2F55;
        }
    }
}
</style>
